def get_valid_number(prompt):
    """获取有效的非负数值输入"""
    while True:
        try:
            value = float(input(prompt))
            if value < 0:
                print("❌ 输入不能为负数，请重新输入！")
            else:
                return value
        except ValueError:
            print("❌ 输入错误，请输入有效的数字！")


def determine_member_level(consumption, points):
    """根据消费金额和积分判断会员等级"""
    # 按等级从高到低判断（高等级优先）
    if consumption >= 1000 or points >= 10000:
        return "钻石会员"
    elif (500 <= consumption < 1000) or (5000 <= points < 10000):
        return "白金会员"
    elif (200 <= consumption < 500) or (2000 <= points < 5000):
        return "黄金会员"
    elif (100 <= consumption < 200) or (1000 <= points < 2000):
        return "白银会员"
    elif 500 <= points < 1000:
        return "青铜会员"
    else:  # 积分<500时
        return "普通会员"


def main():
    print("="*40)
    print("欢迎使用会员等级评定系统")
    print("="*40)
    
    # 获取用户消费金额和积分
    consumption = get_valid_number("请输入您的消费金额（元）：")
    points = get_valid_number("请输入您的积分（分）：")
    
    # 计算并展示会员等级
    level = determine_member_level(consumption, points)
    print("\n" + "="*40)
    print(f"您的消费金额：{consumption:.2f}元")
    print(f"您的当前积分：{points:.0f}分")
    print(f"您的会员等级为：{level}")
    print("="*40)


if __name__ == "__main__":
    main()